package com.scvtc.controller.party;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.dto.party.PartyBaseDto;
import com.scvtc.domain.entity.party.PartyBase;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.service.party.PartyBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "党员信息管理(PartyController)")
@RestController
@RequestMapping("partyBase")
public class PartyBaseController {

    @Autowired
    PartyBaseService partyBaseService;

    @GetMapping("/list")
    @ApiOperation("查询党员信息")
    public ResResult<PageVo<List<PartyBase>>> getAllTeacherSocialService(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            PartyBaseDto partyBaseDto) {
        return partyBaseService.getAllPartyInfo(current, size, partyBaseDto);
    }

    @PutMapping("/")
    @ApiOperation("修改党员信息")
    public ResResult<?> updateStudentBase(@RequestBody PartyBaseDto partyBaseDto) {
        return partyBaseService.upDataPartInfo(partyBaseDto);
    }

    @PostMapping("/")
    @ApiOperation("新增党员信息")
    public ResResult<?> addPartInfo(@RequestBody PartyBaseDto partyBaseDto) {
        return partyBaseService.addPartInfo(partyBaseDto);
    }
}
